<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>参与会员</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-card layui-col-md12">
          <div class="layui-card-header">
						<i class="fa fa-list"></i> 参与列表
						<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>	
					</div>
          <div class="layui-card-body" pad15>
						  <div class="layui-col-md2" style="padding-bottom:10px">

						  </div>
						<div class="layui-form layui-col-md10 layui-form-search">
							<div class="layui-inline layuiadmin-input-useradmin">
								<label class="layui-form-label">用户ID</label>
								<div class="layui-input-inline">
									<input type="text" name="mid" autocomplete="off" class="layui-input" value="">
								</div>
							</div>
							<div class="layui-inline layuiadmin-input-useradmin">
								<label class="layui-form-label">昵称</label>
								<div class="layui-input-inline">
									<input type="text" name="nickname" autocomplete="off" class="layui-input" value="">
								</div>
							</div>
							
							<div class="layui-inline">
								<label class="layui-form-label">时间</label>
								<div class="layui-input-inline" style="width:180px">
									<input type="text" name="ctime" id="ctime" autocomplete="off" class="layui-input">
								</div>
							</div>

							<div class="layui-inline">
								<button class="layui-btn layuiadmin-btn-replys" lay-submit="" lay-filter="LAY-app-forumreply-search">
									<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
								</button>
							</div>
						</div>
						<div class="layui-col-md12">
							<table id="tabledata" lay-filter="tabledata"></table>
						</div>
          </div>
        </div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	layui.laydate.render({ 
		elem: '#ctime',
		trigger: 'click',
		range: '~' //或 range: '~' 来自定义分割字符
	});
  var table = layui.table;
	var datawhere = {};
  //数据表
  var tableIns = table.render({
    elem: '#tabledata'
    ,url: '{$Request.url}' //数据接口
    ,page: true //开启分页
    ,cols: [[ //表头
			{type:"checkbox"},
      {field: 'id', title: 'ID',sort:true, width:80},
      {field: 'nickname', title: '用户信息',templet:'<div><img src="{{d.headimg}}" style="width:40px"> {{d.nickname}}(ID:{{d.mid}})</div>'},
	  {field: 'cashback_money_max', title: '额度',templet:function(d){
			  var html = '';
			  if(d.cashback_money_max <= 0) html+='不限';
			  if(d.cashback_money_max > 0) html+=d.cashback_money_max;
			  return html;
		  }},
		  {field: 'cashback_money', title: '已返金额',templet:function(d){
				  var html = '';
				  if(d.cashback_money >= 0) html+=d.cashback_money;
				  return html;
			  }},
		  {field: 'commission', title: '已返佣金',templet:function(d){
				  var html = '';
				  if(d.commission >= 0) html+=d.commission;
				  return html;
			  }},
		  {field: 'score', title: '已返积分',templet:function(d){
				  var html = '';
				  if(d.score >= 0) html+=d.score;
				  return html;
			  }},
		  {field: 'pro_num', title: '购买数量'},
      {field: 'create_time', title: '时间',templet:function(d){ return date('Y-m-d H:i:s',d.create_time)}},
	  {field: 'operation', title: '操作',templet: function(d){
                var html = '';
                html += '<button class="table-btn" onclick="openmax(\'{:url('recordlog')}/pro_id/'+d.pro_id+'/mid/'+d.mid+'/cashback_id/'+d.cashback_id+'\')">返现记录</button>';
                return html;
      },width:150}
    ]]
  });
	//排序
	table.on('sort(tabledata)', function(obj){
		datawhere.field = obj.field;
		datawhere.order = obj.type;
		tableIns.reload({
			initSort: obj,
			where: datawhere
		});
	});
	//检索
	layui.form.on('submit(LAY-app-forumreply-search)', function(obj){
		var field = obj.field
		var olddatawhere = datawhere
		datawhere = field
		datawhere.field = olddatawhere.field
		datawhere.order = olddatawhere.order
		tableIns.reload({
			where: datawhere,
			page: {curr: 1}
		});
	})
	</script>
	{include file="public/copyright"/}
</body>
</html>